package org.dromara.system.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum PayTypeEnum {

    //支付宝app支付
    ALIPAY_APP(0, "ALIPAY_APP", "aliPayApp"),
    //支付宝h5支付
    ALIPAY_H5(1, "ALIPAY_H5", "aliPayH5"),
    //微信小程序支付
    WECHAT(2, "WECHAT", "wechat"),
    //微信公众号支付
    GZH(3, "WECHAT_GZH_PAY", "wechatGzhPay");
    private final Integer code;
    private final String name;
    private final String serviceName;

    public static PayTypeEnum findOne(Integer code) {
        return Arrays.stream(PayTypeEnum.values())
            .filter(type -> type.getCode().equals(code)).findAny().orElse(null);
    }
}
